﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package org.aswing {
    import flash.display.*;
    import flash.utils.*;

    public class JSharedToolTip extends JToolTip {

        private static var sharedInstance:JSharedToolTip;

        private var targetedComponent:InteractiveObject;
        private var textMap:Dictionary;

        public function JSharedToolTip(){
            setName("JSharedToolTip");
            this.textMap = new Dictionary(true);
        }
        public static function getSharedInstance():JSharedToolTip{
            if (sharedInstance == null){
                sharedInstance = new (JSharedToolTip)();
            };
            return (sharedInstance);
        }
        public static function setSharedInstance(_arg1:JSharedToolTip):void{
            if (sharedInstance){
                throw (new Error("sharedInstance is already set!"));
            };
            sharedInstance = _arg1;
        }

        public function registerComponent(_arg1:InteractiveObject, _arg2:String=null):void{
            listenOwner(_arg1, true);
            this.textMap[_arg1] = _arg2;
            if (this.getTargetComponent() == _arg1){
                setTipText(this.getTargetToolTipText(_arg1));
            };
        }
        public function unregisterComponent(_arg1:InteractiveObject):void{
            unlistenOwner(_arg1);
            delete this.textMap[_arg1];
            if (this.getTargetComponent() == _arg1){
                disposeToolTip();
                this.targetedComponent = null;
            };
        }
        override public function setTargetComponent(_arg1:InteractiveObject):void{
            this.registerComponent(_arg1);
        }
        override public function getTargetComponent():InteractiveObject{
            return (this.targetedComponent);
        }
        protected function getTargetToolTipText(_arg1:InteractiveObject):String{
            var _local2:Component;
            if ((_arg1 is Component)){
                _local2 = (_arg1 as Component);
                return (_local2.getToolTipText());
            };
            return (this.textMap[_arg1]);
        }
        override protected function __compRollOver(_arg1:InteractiveObject):void{
            var _local2:String = this.getTargetToolTipText(_arg1);
            if (((!((_local2 == null))) && (isWaitThenPopupEnabled()))){
                this.targetedComponent = _arg1;
                setTipText(_local2);
                startWaitToPopup();
            };
        }
        override protected function __compRollOut(_arg1:InteractiveObject):void{
            if ((((_arg1 == this.targetedComponent)) && (isWaitThenPopupEnabled()))){
                disposeToolTip();
                this.targetedComponent = null;
            };
        }

    }
}//package org.aswing 
